﻿@using Telerik.Web.Mvc.UI
@model ProductVariantModel
@{
    var fullProductName = "";
    if (!string.IsNullOrWhiteSpace(Model.Name))
    {
        fullProductName = Model.ProductName + " (" + Model.Name + ")";
    }
    else
    {
        fullProductName = Model.ProductName;
    }

    //page title
    ViewBag.Title = string.Format(T("Admin.Catalog.Products.Variants.EditProductVariantDetails").Text, fullProductName);
}
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "productvariant-form" }))
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Administration/Content/images/ico-catalog.png")" alt="" />
            @string.Format(T("Admin.Catalog.Products.Variants.EditProductVariantDetails").Text, fullProductName) @Html.ActionLink("(" + T("Admin.Catalog.Products.Variants.BackToProduct") + ")", "Edit", "Product", new { Id = Model.ProductId }, null)
        </div>
        <div class="options">
            <input type="submit" name="save" class="t-button" value="@T("Admin.Common.Save")" />
            <input type="submit" name="save-continue" class="t-button" value="@T("Admin.Common.SaveContinue")" />
            <input type="submit" id="copyproductvariant" name="copyproductvariant" class="t-button" value="@T("Admin.Catalog.Products.Variants.Copy")" />
            <span id="productvariant-delete" class="t-button">@T("Admin.Common.Delete")</span>
        </div>
    </div>
    @Html.Partial("_CreateOrUpdate", Model)
}
@Html.DeleteConfirmation("productvariant-delete")


@*copy product form*@
@{Html.Telerik().Window()
        .Name("copyproductvariant-window")
        .Title(T("Admin.Catalog.Products.Variants.Copy").Text)
        .Content(@<text>
    @using (Html.BeginForm("CopyProductVariant", "ProductVariant"))
    {
        @Html.HiddenFor(model => Model.CopyProductVariantModel.Id)
        <table style="text-align: left;">
            <tr>
                <td>
                    @Html.NopLabelFor(model => model.CopyProductVariantModel.Name):
                </td>
                <td>
                    @Html.EditorFor(model => Model.CopyProductVariantModel.Name)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.NopLabelFor(model => model.CopyProductVariantModel.Published):
                </td>
                <td>
                    @Html.EditorFor(model => Model.CopyProductVariantModel.Published)
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" class="t-button" value="@T("Admin.Catalog.Products.Variants.Copy")" />
                </td>
            </tr>
        </table>
    }
    </text>)
        .Width(400)
        .Draggable(true)
        .Modal(true)
        .Visible(false)
        .Render();
}
<script type="text/javascript">
    $(document).ready(function () {

        $("#copyproductvariant").click(function (e) {
            e.preventDefault();
            $('#copyproductvariant-window').data('tWindow').center().open();
        });
    });
</script>
